//Read and send all analog and digital inputs over serial as formatted ascii string.
//Sends a string with the format "an bn cn dn en fn #BBBBBBBBBBBB\r\n"
//where:
// n is a non-negative decimal number (arbitrary number of digits)
//B is a binary digit, 1 or 0
// \r\n is carriage-return and a newline (ascii chars 10, 13)
//example: a812 b20 c3 d1017 e233 f96 #101100100111
//note: there's no real need to have the a, b, c, annotations in the output string - we have a fix sending sequence.

void setup()
{
  Serial.begin(9600);
  for (int i=2; i<=13; i++)
  {
    pinMode(i, OUTPUT);
  }
}

void loop()
{
  Serial.print("a");
  Serial.print(analogRead(0));
  Serial.print(" ");

  Serial.print("b");
  Serial.print(analogRead(1));
  Serial.print(" ");
  
  Serial.print("c");
  Serial.print(analogRead(2));
  Serial.print(" ");
  
  Serial.print("d");
  Serial.print(analogRead(3));
  Serial.print(" ");
  
  Serial.print("e");
  Serial.print(analogRead(4));
  Serial.print(" ");
  
  Serial.print("f");
  Serial.print(analogRead(5));
  Serial.print(" ");


  //now print the digital inputs e.g. #001101001011
  Serial.print("#");  
  //you don't need to use a loop here
  for (int i=2; i<=13; i++)
  {
    Serial.print(digitalRead(i));
  }
  Serial.println();
  delay(20);
}
